#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <unordered_set>
#define int long long 
#define x first 
#define y second 
using namespace std;

void solve()
{
    int n,k,x;
    cin >> n >> k >> x;
    vector<int> vc(n);
    set<int> st;
    for(int i = 0; i < n; i++) cin >> vc[i];
    int minx = x * n;  // 依次删除第一个元素
    int ans = 0;
    //反着去判断当前数组中不包含的最小非负整数
    for(int j = n - 1; j >= 0; j--)
    {
        st.insert(vc[j]);
        while(st.count(ans)) 
        {
            ans++;
        }
        //依次删除前j个元素再将剩下的元素按照MEX(a) * k删除
       // cout << x << " " << j << " " << k << " " << ans << endl;
        int p = x * j + k * ans;
        //cout << p << endl;
        minx = min(minx , p);
    }
    cout << minx << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t;
    cin >> t;
    while(t -- )  solve();
    return 0;
}



